package com.zbs.framework.dao.passport.wechat.repository;

import com.zbs.framework.dao.passport.entity.AcctWechat;
import com.zbs.framework.dao.passport.entity.MNAccount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface AcctWechatRepository extends JpaRepository<AcctWechat, String> , JpaSpecificationExecutor<AcctWechat> {

    @Query("select a from AcctWechat aw left join MNAccount a on aw.acctUuid = a.uuid where aw.openId = :openId")
    MNAccount findAccount(@Param("openId") String openId);

    AcctWechat findByAcctUuid(String acctUuid);

    void deleteAllByAcctUuid(String acctUuid);
}
